package org.robotjuice.turtleflip;

import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;

/**
 * Handles service start after boot, see Manifest
 * @author matias
 * under GPL v3 : http://www.gnu.org/licenses/gpl-3.0.html
 */
public class TurtleServiceManager extends BroadcastReceiver
{
	public void onReceive(Context context, Intent intent)
	{
		// If action is ACTION_BOOT_COMPLETE
		// Should be the only caught Intent since Manifest has filter for it
		if(intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED))
		{
			ComponentName component = new ComponentName(context.getPackageName(), TurtleService.class.getName());
			context.startService(new Intent().setComponent(component)); // Start the service
		}
	}
}
